package com.saudidentalapp;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.text.Html;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;
import android.widget.TextView;

import com.saudiapp.webservice.Constants;
import com.saudiapp.webservice.Responce;
import com.saudiapp.webservice.Utilities;
import com.saudiapp.webservice.WebServiceManager;
import com.saudiapp.webservice.WebServiceManager.WebServiceListener;

public class ContactDentalSociety extends Activity implements WebServiceListener
{

	TextView txtAboutAppDescription;
	TextView txtVersionName;
	
	TextView txtAboutDsDescription;
	ImageView welcome_image;
	Utilities utilities;
	@Override
	protected void onCreate(Bundle savedInstanceState) 
	{
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_contact_dental_society);
		txtAboutDsDescription=(TextView)findViewById(R.id.xtxtAboutApplicationDescription);
		//welcome_image=(ImageView)findViewById(R.id.xwelcome_image);
		//welcome_image.setVisibility(View.INVISIBLE);
		setView();
	}
	 
	private void setView()
	{
		utilities=Utilities.getInstance(ContactDentalSociety.this);
		utilities.showProgreessDialog();
		if(utilities.haveNetworkConnection())
		{
			WebServiceManager webServiceManager=new WebServiceManager(this);
			webServiceManager.setonWebServiceListener(this);
			//webServiceManager.getContactUs();//getAboutDentalSociety();	
			webServiceManager.getContactUsInformation();
			//webServiceManager.getGallaryInformation();
		}
		else
		{	utilities.dismiss();
			utilities.showToast(Constants.INTERNET_NOT_AVAILABELE);
		}
		
		
		final Activity activity=this;
		ImageView imgBack=(ImageView)findViewById(R.id.xbtnVwBack);
		imgBack.setOnClickListener(new OnClickListener() 
		{
			
			@Override
			public void onClick(View arg0) 
			{
				finish();
				startActivity(new Intent(activity,TabActivity.class).addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP));
				
			}
		});
			
	}

	@Override
	public void onProcesCompleted(int requestId, Object Data) 
	{	
		utilities.dismiss();		
		//WelcomeMessage welcomeMessage=(WelcomeMessage) ((Responce)Data).getResponceData();		
		//ImageLoader imageLoader=new ImageLoader(AboutDsActivity.this);
		//imageLoader.DisplayImage(welcomeMessage.getImage(), welcome_image);
		//welcome_image.setVisibility(View.VISIBLE);
		
		txtAboutDsDescription.setText(Html.fromHtml(((Responce)Data).getResponceData().toString()));
	}

	@Override
	public void onErrorOccured(int requestId) 
	{
		utilities.dismiss();	
		utilities.showToast(Constants.ERROR_MESSAGE);
		
	}
}